home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8348 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Explain this> %s \"%[^\"]\"
  5. Date: 29 Feb 96 12:30:03 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.825597003@rscernix>
  8. References: <4h2t6u$v56@useneta1.news.prodigy.com>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. DZYS46D@prodigy.com (David Cunningham) writes:
  13.  
  14. >I have a file that contains text like this:
  15. >
  16. >012345678     "Joe  Smith"
  17. >
  18. >I also have an example of sscanf to pick out these fields. Can someone 
  19. >translate what  \"%[^\"]\"%d"  means. I need to have a good understanding 
  20. >of this for a homework assignment. It looks like this:
  21. >
  22. >sscanf(buff,"%s \ "%[^\"]\" %d",student_list->ss_num,student_list->name);
  23.  
  24. This format string matches neither the input line nor the sscanf
  25. argument list.  Make it: "%s \"%[^\"]\"" if student_list->ss_num is 
  26. a character array, "%d \"%[^\"]\"" if it is an int, and so on. 
  27.  
  28. >Please explain what these hieroglyphics mean, character by character.
  29.  
  30. Please open your C book and read the description of the scanf library
  31. function.  This newsgroup is not meant as a replacement for your book.
  32. If, after reading it, you still have problems with this format string,
  33. feel free to ask specific specific questions about the parts you don't
  34. understand.
  35.  
  36. We are here to help you, not to spoon-feed you.
  37.  
  38. Dan
  39. --
  40. Dan Pop
  41. CERN, CN Division
  42. Email: danpop@mail.cern.ch 
  43. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  44.